package com.pretty.test.controller.pets.baikeanimaltype;


import com.baomidou.mybatisplus.extension.api.R;
import com.pretty.test.controller.pets.baikeanimaltype.vo.BaikeAnimalTypeListVO;
import com.pretty.test.controller.pets.blog.dto.BlogPageDTO;
import com.pretty.test.controller.pets.blog.vo.BlogPageVO;
import com.pretty.test.entity.PetsBaikeAnimalType;
import com.pretty.test.entity.PetsBlog;
import com.pretty.test.service.IPetsBaikeAnimalTypeService;
import com.pretty.test.service.IPetsBlogService;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 百科动物种类控制器
 * @author dujianyu
 * @since 2021-04-13
 */
@RestController
@AllArgsConstructor
@RequestMapping("/baike-animal-type")
public class PetsBaikeAnimalTypeController {
    private IPetsBaikeAnimalTypeService service;

    /**
     * 自定义列表
     */
    @GetMapping("/list")
    public R<List<BaikeAnimalTypeListVO>> list(){
        return R.ok(service.selectBaikeAnimalTypeList());
    }

    /**
     * 新增或修改
     * @param petsBaikeAnimalType
     */
    @PostMapping("/submit")
    public  R<Boolean> submit(@RequestBody PetsBaikeAnimalType petsBaikeAnimalType){
        return R.ok(service.saveOrUpdate(petsBaikeAnimalType));
    }

    /**
     * 逻辑删除
     * @param id
     */
    @PostMapping("/delete")
    public R<Boolean> delete(String id){
        return R.ok(service.removeById(id));
    }
}
